package com.manor.paradise.dialog

import android.app.Activity
import android.content.Context
import android.text.TextUtils
import com.blankj.utilcode.util.ToastUtils
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.core.BasePopupView
import com.lxj.xpopup.impl.FullScreenPopupView
import com.lxj.xpopup.interfaces.SimpleCallback
import com.manor.common.dialog.XCodeImgPopup
import com.manor.common.utils.RouteUtil
import com.manor.common.utils.StaIntentUtil
import com.manor.common.utils.ToastUtil
import com.manor.paradise.R
import kotlinx.android.synthetic.main.dialog_complete.view.*

/**
 * 完成任务
 * @constructor
 */
class CompletePopup(context: Context, val listener: () -> Unit) : FullScreenPopupView(context) {

    companion object {
        fun load(context: Activity, listener: () -> Unit) {
            XPopup.Builder(context)
                    .dismissOnTouchOutside(false)
                    .dismissOnTouchOutside(false)
                    .isDestroyOnDismiss(true)
                    .hasBlurBg(true)
                    .asCustom(CompletePopup(context, listener))
                    .show()
        }
    }

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_complete
    }

    override fun onCreate() {
        super.onCreate()
        tv_btn.setOnClickListener {
            dismiss()
            listener.invoke()
        }
        im_dismiss.setOnClickListener {
            dismiss()
        }
    }


    override fun onDestroy() {
        super.onDestroy()
    }
}